<?php

require_once __DIR__ . '/../bootstrap.php';

use Symfony\Component\Validator\Validation;
use Entity\User;

$validator = Validation::createValidatorBuilder()
    ->enableAnnotationMapping()
    ->getValidator();

// part 1
$user = new User('John Doe', 'john@example.com');

$violations = $validator->validate($user);

var_dump($violations);

// part 2
$user = new User('John Doe', 'john@gmail.com');

$violations = $validator->validate($user);

var_dump($violations);